package PTA.javaA;

import java.util.Scanner;

public class ex30 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

      int [] arr = new int[5];
      String line;
while(true){
    line = sc.next();
    if(line.equals("arr")){
        int num = sc.nextInt();
        if(num>4||num<0){
        System.out.println("java.lang.ArrayIndexOutOfBoundsException: "+num);
    }
    }else if(line.equals("null")){
        System.out.println("java.lang.NullPointerException");
    }else if(line.equals("cast")){
        System.out.println("java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer");
    }else if(line.equals("num")){
        String num = sc.next();
        char p = num.charAt(arr[0]);
        if(p>57||p<48){
            System.out.println("java.lang.NumberFormatException: For input string: "+'"'+p+'"');

        }
    }else if(line.equals("other")){
        System.exit(0);
    }
}


    }
}
